<?php

	function getUrl(){
		$host  = $_SERVER['HTTP_HOST'];
		$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
		return "http://$host$uri";
	}

	function redirect($fileName){
		header("Location: ". getUrl() ."/$fileName");
	}
	
	function post($fileName, $post_data){
		$content_length = strlen($post_data);
		header('POST /'. $fileName . ' HTTP/1.1');
		header('Host: '. getUrl());
		header('Connection: close');
		header('Content-type: application/x-www-form-urlencoded');
		header('Content-length: ' . $content_length);
		header('');
		header($post_data);
	}
?>